<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    const obj = {
        name:"obj",
        a:10,b:20,c:30
    }

    const result = new Proxy(obj, {
        get(origin, attrs){
            console.log(`正在访问${origin.name}对象的${attrs}属性`);
            return origin[attrs];
        },
        set(origin, attrs, value){
            console.log(`正在修改${origin.name}对象的${attrs}属性，修改后的值为${value}`)
            origin[attrs] = value;
        }
    })

    obj.hobby = "篮球";

    result.a = "hello";
    result.b = "world";
    result.c = "hahaha";

    console.log(result.a);
    console.log(result.b);
    console.log(result.c);
    console.log(result);



</script>
</html>